Querying itemRef for Folder

Hi,

Is there any construct in DXL for querying item for type. I am looping through a Folder and want to populate a choice dialogue with items in the folder that are either folders or projects?

void getStd(Folder f)
{
    Item itemRef
    int i = 0

// test item for type folder and if so....
    for itemRef in (current Folder) do
    {                   
         insert(stdDBE,i++,(name(itemRef)))
        set(stdDBE,0)
    }    
}  

 

Thanks in advance

Mark


mwilliamson - Wed Jan 08 10:18:29 EST 2014

Re: Querying itemRef for Folder
llandale - Wed Jan 08 11:57:59 EST 2014

  • string IType = type(itemRef)
  • if (IType == "Project") then {..}
  • elseif(IType == "Folder") then {..}
  • elseif(IType == "Formal") then {..}
  • elseif(IType == "Link") then {..}
  • elseif(IType == "Descriptive") then {..}
  • else{Louie made a mistake}

Be advised that the "type()" of a Project is exactly "Project" and is not "Folder".  Thus you will realistically often do this:

  • if (type(itemRef) == "Folder" or type(itemRef) == "Project") then {deal with sub-folder}

-Louie

 

Re: Querying itemRef for Folder
mwilliamson - Wed Jan 08 13:02:17 EST 2014

llandale - Wed Jan 08 11:57:59 EST 2014

  • string IType = type(itemRef)
  • if (IType == "Project") then {..}
  • elseif(IType == "Folder") then {..}
  • elseif(IType == "Formal") then {..}
  • elseif(IType == "Link") then {..}
  • elseif(IType == "Descriptive") then {..}
  • else{Louie made a mistake}

Be advised that the "type()" of a Project is exactly "Project" and is not "Folder".  Thus you will realistically often do this:

  • if (type(itemRef) == "Folder" or type(itemRef) == "Project") then {deal with sub-folder}

-Louie

 

Many thanks Louie. How come I can't find that in the DXL Ref Manual?

Mark

Re: Querying itemRef for Folder
llandale - Thu Jan 09 14:45:20 EST 2014

mwilliamson - Wed Jan 08 13:02:17 EST 2014

Many thanks Louie. How come I can't find that in the DXL Ref Manual?

Mark

It is in the DXL manual.   Command "type" after command "setShowDeletedItems" section "Hierarchy information" chapter "Rational DOORS hierarchy".  In the help "index" it is command "type(item)".